package com.ymatou.iapi.csim.testcase;

import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.csim.parameter.GetCsMaxSessionCountBean;
import com.ymatou.iapi.csim.service.GetCsMaxSessionCountCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.database.model.ymt_csmaxsessioncount;
import com.ymttest.database.sqlwapper.CSIM.ymt_csmaxsessioncountWapper;
/**
*查询客服最大会话数列表
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetCsMaxSessionCount{
	private static GetCsMaxSessionCountBean getcsmaxsessioncountBean;
	private static GetCsMaxSessionCountCall getcsmaxsessioncountCall;
	private ymt_csmaxsessioncountWapper csmaxsessioncountWapper=new ymt_csmaxsessioncountWapper();
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("查询客服最大会话数列表");
	}

	@Before
	public void caseUp() {
		getcsmaxsessioncountBean=new GetCsMaxSessionCountBean();
		getcsmaxsessioncountCall=new GetCsMaxSessionCountCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getcsmaxsessioncountCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetCsMaxSessionCount_001() {
		Logger.start(true,"查询客服最大会话数列表");
		try {

			getcsmaxsessioncountCall.setData(getcsmaxsessioncountBean);
			getcsmaxsessioncountCall.callService();		
			//断言
			Logger.verifyEquals("200", getcsmaxsessioncountCall.getStatus(), "验证status");
			Logger.verifyEquals("", getcsmaxsessioncountCall.getMsg(), "验证Msg");
			List<ymt_csmaxsessioncount> list=csmaxsessioncountWapper.selectAll();
			for(int i=0;i<list.size();i++)
			{
				Logger.verifyEquals(getcsmaxsessioncountCall.getResult().getJSONObject(i).getInt("CSId"), list.get(i).getCSId(), 
						"验证ymt_csmaxsessioncount表第"+(i+1)+"个字段CSId是否正确");
				Logger.verifyEquals(getcsmaxsessioncountCall.getResult().getJSONObject(i).getInt("MaxSessionCount"), list.get(i).getMaxSessionCount(), 
						"验证ymt_csmaxsessioncount表第"+(i+1)+"个字段MaxSessionCount是否正确");
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}